﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.5
// Code is generated on: Monday, December 17, 2012 11:21:25 AM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET35
// Templates vendor: Solutions Design.
////////////////////////////////////////////////////////////// 
using System;
using WHMS.EntityClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using SD.LLBLGen.Pro.QuerySpec;

namespace WHMS.FactoryClasses
{
	/// <summary>Factory class to produce DynamicQuery instances and EntityQuery instances</summary>
	public partial class QueryFactory
	{
		private int _aliasCounter = 0;

		/// <summary>Creates a new DynamicQuery instance with no alias set.</summary>
		/// <returns>Ready to use DynamicQuery instance</returns>
		public DynamicQuery Create()
		{
			return Create(string.Empty);
		}

		/// <summary>Creates a new DynamicQuery instance with the alias specified as the alias set.</summary>
		/// <param name="alias">The alias.</param>
		/// <returns>Ready to use DynamicQuery instance</returns>
		public DynamicQuery Create(string alias)
		{
			return new DynamicQuery(new ElementCreator(), alias, this.GetNextAliasCounterValue());
		}
	
		/// <summary>Creates a new EntityQuery for the entity of the type specified with no alias set.</summary>
		/// <typeparam name="TEntity">The type of the entity to produce the query for.</typeparam>
		/// <returns>ready to use EntityQuery instance</returns>
		public EntityQuery<TEntity> Create<TEntity>()
			where TEntity : IEntityCore
		{
			return Create<TEntity>(string.Empty);
		}

		/// <summary>Creates a new EntityQuery for the entity of the type specified with the alias specified as the alias set.</summary>
		/// <typeparam name="TEntity">The type of the entity to produce the query for.</typeparam>
		/// <param name="alias">The alias.</param>
		/// <returns>ready to use EntityQuery instance</returns>
		public EntityQuery<TEntity> Create<TEntity>(string alias)
			where TEntity : IEntityCore
		{
			return new EntityQuery<TEntity>(new ElementCreator(), alias, this.GetNextAliasCounterValue());
		}
				
		/// <summary>Creates a new field object with the name specified and of resulttype 'object'. Used for referring to aliased fields in another projection.</summary>
		/// <param name="fieldName">Name of the field.</param>
		/// <returns>Ready to use field object</returns>
		public EntityField2 Field(string fieldName)
		{
			return Field<object>(string.Empty, fieldName);
		}

		/// <summary>Creates a new field object with the name specified and of resulttype 'object'. Used for referring to aliased fields in another projection.</summary>
		/// <param name="targetAlias">The alias of the table/query to target.</param>
		/// <param name="fieldName">Name of the field.</param>
		/// <returns>Ready to use field object</returns>
		public EntityField2 Field(string targetAlias, string fieldName)
		{
			return Field<object>(targetAlias, fieldName);
		}

		/// <summary>Creates a new field object with the name specified and of resulttype 'TValue'. Used for referring to aliased fields in another projection.</summary>
		/// <typeparam name="TValue">The type of the value represented by the field.</typeparam>
		/// <param name="fieldName">Name of the field.</param>
		/// <returns>Ready to use field object</returns>
		public EntityField2 Field<TValue>(string fieldName)
		{
			return Field<TValue>(string.Empty, fieldName);
		}

		/// <summary>Creates a new field object with the name specified and of resulttype 'TValue'. Used for referring to aliased fields in another projection.</summary>
		/// <typeparam name="TValue">The type of the value.</typeparam>
		/// <param name="targetAlias">The alias of the table/query to target.</param>
		/// <param name="fieldName">Name of the field.</param>
		/// <returns>Ready to use field object</returns>
		public EntityField2 Field<TValue>(string targetAlias, string fieldName)
		{
			return new EntityField2(fieldName, targetAlias, typeof(TValue));
		}
		
		/// <summary>Gets the next alias counter value to produce artifical aliases with</summary>
		private int GetNextAliasCounterValue()
		{
			_aliasCounter++;
			return _aliasCounter;
		}
		
		/// <summary>Creates and returns a new EntityQuery for the Contractor entity</summary>
		public EntityQuery<ContractorEntity> Contractor
		{
			get { return Create<ContractorEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the Currency entity</summary>
		public EntityQuery<CurrencyEntity> Currency
		{
			get { return Create<CurrencyEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the DepositTransaction entity</summary>
		public EntityQuery<DepositTransactionEntity> DepositTransaction
		{
			get { return Create<DepositTransactionEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the DepositType entity</summary>
		public EntityQuery<DepositTypeEntity> DepositType
		{
			get { return Create<DepositTypeEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the InitialBalance entity</summary>
		public EntityQuery<InitialBalanceEntity> InitialBalance
		{
			get { return Create<InitialBalanceEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the InspectionType entity</summary>
		public EntityQuery<InspectionTypeEntity> InspectionType
		{
			get { return Create<InspectionTypeEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the Inventory entity</summary>
		public EntityQuery<InventoryEntity> Inventory
		{
			get { return Create<InventoryEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the InventoryItem entity</summary>
		public EntityQuery<InventoryItemEntity> InventoryItem
		{
			get { return Create<InventoryItemEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the Item entity</summary>
		public EntityQuery<ItemEntity> Item
		{
			get { return Create<ItemEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the ItemSupplier entity</summary>
		public EntityQuery<ItemSupplierEntity> ItemSupplier
		{
			get { return Create<ItemSupplierEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the ItemType entity</summary>
		public EntityQuery<ItemTypeEntity> ItemType
		{
			get { return Create<ItemTypeEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the Project entity</summary>
		public EntityQuery<ProjectEntity> Project
		{
			get { return Create<ProjectEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the ProjectContractor entity</summary>
		public EntityQuery<ProjectContractorEntity> ProjectContractor
		{
			get { return Create<ProjectContractorEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the ProjectItemPlan entity</summary>
		public EntityQuery<ProjectItemPlanEntity> ProjectItemPlan
		{
			get { return Create<ProjectItemPlanEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the RetrievalTransaction entity</summary>
		public EntityQuery<RetrievalTransactionEntity> RetrievalTransaction
		{
			get { return Create<RetrievalTransactionEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the Role entity</summary>
		public EntityQuery<RoleEntity> Role
		{
			get { return Create<RoleEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the Shelf entity</summary>
		public EntityQuery<ShelfEntity> Shelf
		{
			get { return Create<ShelfEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the ShelfType entity</summary>
		public EntityQuery<ShelfTypeEntity> ShelfType
		{
			get { return Create<ShelfTypeEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the Store entity</summary>
		public EntityQuery<StoreEntity> Store
		{
			get { return Create<StoreEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the Storekeeper entity</summary>
		public EntityQuery<StorekeeperEntity> Storekeeper
		{
			get { return Create<StorekeeperEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the StoreShelfBalance entity</summary>
		public EntityQuery<StoreShelfBalanceEntity> StoreShelfBalance
		{
			get { return Create<StoreShelfBalanceEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the Supplier entity</summary>
		public EntityQuery<SupplierEntity> Supplier
		{
			get { return Create<SupplierEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the SupplyOrder entity</summary>
		public EntityQuery<SupplyOrderEntity> SupplyOrder
		{
			get { return Create<SupplyOrderEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the SupplyOrderItem entity</summary>
		public EntityQuery<SupplyOrderItemEntity> SupplyOrderItem
		{
			get { return Create<SupplyOrderItemEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the Transaction entity</summary>
		public EntityQuery<TransactionEntity> Transaction
		{
			get { return Create<TransactionEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the TransactionItem entity</summary>
		public EntityQuery<TransactionItemEntity> TransactionItem
		{
			get { return Create<TransactionItemEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the TransferRequest entity</summary>
		public EntityQuery<TransferRequestEntity> TransferRequest
		{
			get { return Create<TransferRequestEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the TransferRequestItem entity</summary>
		public EntityQuery<TransferRequestItemEntity> TransferRequestItem
		{
			get { return Create<TransferRequestItemEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the TransferTransaction entity</summary>
		public EntityQuery<TransferTransactionEntity> TransferTransaction
		{
			get { return Create<TransferTransactionEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the Unit entity</summary>
		public EntityQuery<UnitEntity> Unit
		{
			get { return Create<UnitEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the UnitConverter entity</summary>
		public EntityQuery<UnitConverterEntity> UnitConverter
		{
			get { return Create<UnitConverterEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the UnitType entity</summary>
		public EntityQuery<UnitTypeEntity> UnitType
		{
			get { return Create<UnitTypeEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the User entity</summary>
		public EntityQuery<UserEntity> User
		{
			get { return Create<UserEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the UserRole entity</summary>
		public EntityQuery<UserRoleEntity> UserRole
		{
			get { return Create<UserRoleEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the WithdrawalType entity</summary>
		public EntityQuery<WithdrawalTypeEntity> WithdrawalType
		{
			get { return Create<WithdrawalTypeEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the WithdrawRequest entity</summary>
		public EntityQuery<WithdrawRequestEntity> WithdrawRequest
		{
			get { return Create<WithdrawRequestEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the WithdrawRequestItem entity</summary>
		public EntityQuery<WithdrawRequestItemEntity> WithdrawRequestItem
		{
			get { return Create<WithdrawRequestItemEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the WithdrawTransaction entity</summary>
		public EntityQuery<WithdrawTransactionEntity> WithdrawTransaction
		{
			get { return Create<WithdrawTransactionEntity>(); }
		}

		/// <summary>Creates and returns a new EntityQuery for the WithdrawzParty entity</summary>
		public EntityQuery<WithdrawzPartyEntity> WithdrawzParty
		{
			get { return Create<WithdrawzPartyEntity>(); }
		}

	}
}